import request from '@/router/axios'

const path = '/entrance-guard/initialQrManage';
export function fetchList(query) {
  return request({
    url: `${path}/page`,
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: `${path}`,
    method: 'post',
    data: obj
  })
}

export function delObj(id) {
  return request({
    url: `${path}/${id}`,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: `${path}`,
    method: 'put',
    data: obj
  })
}

export function getImg(imgPath) {
  return request({
    url: `${path}/showImg`,
    method: "post",
    data: {
      imgPath
    }
  })
}

const paths = '/admin/bindOwner';
export function communityList(query) {
  return request({
    url: `${paths}/communityList`,
    method: "get",
    params: query
  })
}

export function buildingList(query) {
  return request({
    url: `${paths}/buildingList?communityId=` + query,
    method: "get",
  })
}

export function unitList(query) {
  return request({
    url: `${paths}/unitList?buildingId=` + query,
    method: "get",
  })
}

export function getCommunityById(query) {
  return request({
    url: `${paths}/getCommunityById?id=` + query,
    method: "get",
  })
}

export function getBuildingById(query) {
  return request({
    url: `${paths}/getBuildingById?id=` + query,
    method: "get",
  })
}

export function getUnitById(query) {
  return request({
    url: `${paths}/getUnitById?id=` + query,
    method: "get",
  })
}